/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86184
 * Date: 2023-02-25
 * Time: 11:17
 */
class HeroNode{
    public int index;
    public String name;
    public HeroNode next;

    public HeroNode(int index, String name) {
        this.index = index;
        this.name = name;
    }

    @Override
    public String toString() {
        return "HeroNode{" +
                "index=" + index +
                ", name='" + name + '\'' +
                '}';
    }
}

class ListRealize{
    private HeroNode phead=new HeroNode(0,"");

    public HeroNode cur=phead;
    public void addNode(HeroNode heroNode){
        cur.next=heroNode;
        cur=cur.next;
    }

    public void printList(){
        HeroNode cur1=phead.next;
        while(cur1 != null){
            System.out.println(cur1);
            cur1=cur1.next;
        }
    }
}


public class List1 {
    public static void main(String[] args) {
        HeroNode hero1=new HeroNode(1,"宋江");
        HeroNode hero2=new HeroNode(2,"吴用");
        HeroNode hero3=new HeroNode(3,"卢俊义");
        HeroNode hero4=new HeroNode(4,"林冲");

        ListRealize listRealize=new ListRealize();
        listRealize.addNode(hero1);
        listRealize.addNode(hero2);
        listRealize.addNode(hero3);
        listRealize.addNode(hero4);

        listRealize.printList();
    }
}


